package com.opennews.openplatform

class UserActiveToken {
    String id
    String accountGroupId
    String username
    String ipAddress
    String deviceId                         // Android: androidId; iOS: identifierForVendor.
    String deviceBrand                      // Android: brand; iOS: Hard-coded as "Apple".
    String deviceModel                      // Android: model; iOS: model.
    String deviceProductName                // Android: product; iOS: name.
    String deviceSystemName                 // Android: Hard-coded as "Android"; iOS: systemName.
    String deviceSystemVersion              // Android: version.release; iOS: systemVersion.
    String operatingSystem
    String operatingSystemVersion
    String platformVersion
    String appVersion
    String accessToken
    Integer expiration
    Date dateGenerated
    Date dateExpired
    String refreshToken
    boolean enabled = true
    Date dateCreated
    Date lastUpdated

    static constraints = {
        accountGroupId nullable: false, blank: false
        username nullable: false, blank: false, maxSize: 50
        ipAddress nullable: false, blank: false
        deviceId nullable: true, blank: true, maxSize: 100
        deviceBrand nullable: true, blank: true, maxSize: 100
        deviceModel nullable: true, blank: true, maxSize: 100
        deviceProductName nullable: true, blank: true, maxSize: 100
        deviceSystemName nullable: true, blank: true, maxSize: 100
        deviceSystemVersion nullable: true, blank: true, maxSize: 100
        operatingSystem nullable: true, blank: true, maxSize: 100
        operatingSystemVersion nullable: true, blank: true, maxSize: 100
        platformVersion nullable: true, blank: true, maxSize: 100
        appVersion nullable: true, blank: true, maxSize: 100
        accessToken nullable: false, blank: false, maxSize: 3000
        expiration nullable: false
        dateGenerated nullable: false, blank: false
        dateExpired nullable: false, blank: false
        refreshToken nullable: false, blank: false, maxSize: 3000
    }

    static mapping = {
        // id index: true
        version false
    }
}